﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Threading;
using System.Globalization;
using System.Security.Permissions;

namespace HBAClient
{
    public partial class Dashboard : Form
    {
        public Dashboard()
        {
            InitializeComponent();
        }
        private void tmrSetCurrTime_Tick(object sender, EventArgs e)
        {
            lblTime.Text = DateTime.Now.ToString();
        }
		private void lblCloseDash_Click(object sender, EventArgs e)
		{
			this.Close();
		}
		private void Dashboard_Load(object sender, EventArgs e)
		{
            lblID.Text = Program.GetUserID().ToString();

			HBADBDataContext db = new HBADBDataContext();

            var query = from balance in db.Balances
						join bank in db.Banks on balance.BankID equals bank.BankID
						where balance.UserID == Program.GetUserID()
                        select new { BankName = bank.BankName, CurrentBalance = balance.CurrentBalance};
                        //select new { BankName = bank.BankName, CurrentBalance = balance.CurrentBalance};
                        //select new { balance.CurrentBalance };
                        //select new { bank.BankName, balance.CurrentBalance };
                        //select new { BankName = bank.BankName,
                        //             CurrentBalance = Decimal.Parse(balance.CurrentBalance.ToString())
                        //            };
			dgvDashboard.DataSource = query;

            #region
            //try
            //{
            //    AviMark.WEBProxySoapClient webEngine = null;

            //    try
            //    {
            //        webEngine = new AviMark.WEBProxySoapClient();
                   //lblUSDRateValue.Text = webEngine.GetDollarRate();
            //        //lblLocationValue.Text = webEngine.GetLocation();
            //    }
            //    catch (Exception ex)
            //    {
            //        MessageBox.Show("Cannot connect external web services : " + ex.Message);
            //    }
            //}
            //catch
            //{
            //    lblUSDRateValue.Text = "No Dollar results";
            //}
            #endregion
		}
    }
}

